<template>
	<view class="content">
		<u-navbar leftIconColor="#fff" titleStyle="color:#fff" title="查看凭证" bgColor="transparent" :autoBack="true"
			:placeholder="false">
		</u-navbar>
		<view class="up_top">
			<view class="top_left">
				<view class="left-title">
					确定订单
				</view>
				<view class="time">
					请确定您已收到钱款
				</view>
			</view>
		</view>
		<view class="up_btn" @click="goquer(info.coin.id)">
			确认收款
		</view>
		<view class="my-content" v-if="info.order">
			<view class="info-box">
				<view class="info-head">
					<image :src="info.order.u_img" mode=""></image>
					<view>
						{{info.order.user}}
					</view>
				</view>
				<view class="info-num">
					<view class="num-item">
						<view class="num">
							<text>{{info.coin.price}}</text>CNY
						</view>
						<view class="num-text">
							单价
						</view>
					</view>
					<view class="num-item">
						<view class="num">
							<text>{{info.coin.num}}</text>
						</view>
						<view class="num-text">
							数量
						</view>
					</view>
					<view class="num-item">
						<view class="num">
							<text>{{info.coin.total_price}}</text>CNY
						</view>
						<view class="num-text">
							总价
						</view>
					</view>
				</view>
				<view class="order">
					<view>
						下单时间
					</view>
					<view class="order-time">
						{{$u.timeFormat(info.coin.start_time, 'yyyy-mm-dd hh:MM:ss')}}
					</view>
				</view>
				<view class="up-tips">
					已上传
				</view>
			</view>
			<view class="up-box">
				<image class="up-bg" :src="info.coin.voucher" mode="widthFix"></image>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: 0,
				info: {}
			}
		},
		onLoad(option) {
			this.getList(option.id)
		},
		methods: {
			goquer(id) {
				let app = this
				uni.showModal({
					title: '提示',
					content: '是否确定收款!',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.showLoading({
								mask: true
							})
							let params = {
								id: id
							}
							app.$Request({
								method: 'POST',
								url: '/api/exchange/confirmYkbOrder',
								data: params
							}).then(res => {
								uni.hideLoading()
								if (res.code == 1) {
									uni.showToast({
										title: '您已确定收款！',
										icon: 'none'
									})
									setTimeout(() => {
										uni.switchTab({
											url: '/pages/otc/index'
										})
									}, 1500)
								} else {
									uni.showToast({
										title: res.msg,
										icon: 'none'
									})
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			getList(id) {
				uni.showLoading();
				this.$Request({
					method: 'POST',
					url: '/api/exchange/uploadVoucherykb',
					data: {
						id
					}
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						this.info = res.data
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			},
			gonavto(url) {
				if (url == '') {
					uni.showToast({
						title: '开发中0.0',
						icon: 'none'
					})
				} else {
					uni.navigateTo({
						url: url
					})
				}
			},
			goincome() {
				uni.navigateTo({
					url: '/pages/my/income/index'
				})
			},
			headTab(index) {
				this.headList.map((item) => {
					item.show = false
				})
				this.headList[index].show = true
				this.status = index
			},
		}
	}
</script>

<style>
	page {
		background-color: #17191A;
	}
</style>
<style lang="scss" scoped>
	.content {
		width: 100%;
		background-image: url('../../../static/my/my-bg.png');
		background-repeat: no-repeat;
		background-size: 100% 568rpx;
		padding-top: 120rpx;

		.up_top {
			width: 414rpx;
			height: 414rpx;
			margin: 0 auto;
			padding: 30rpx;
			background-image: url('../../../static/community/top-bg.png');
			background-repeat: no-repeat;
			background-size: 414rpx 414rpx;

			.top_left {
				padding-top: 33%;
				text-align: center;

				.left-title {
					font-size: 40rpx;
					font-weight: 600;
					color: #fff;
				}

				.time {
					font-size: 24rpx;
					color: #cbcbcb;
					margin-top: 20rpx;
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}


		}

		.up_btn {
			text-align: center;
			font-size: 28rpx;
			font-weight: 600;
			line-height: 88rpx;
			width: 318rpx;
			height: 88rpx;
			background: linear-gradient( 90deg, #C8F673 0%, #98F083 100%);
			border-radius: 44rpx;
			margin: 0 auto;
			margin-top: 40rpx;
		}

		.my-content {
			padding: 30rpx;
			color: #fff;

			.info-box {
				padding: 30rpx;
				background: linear-gradient(134deg, rgba(255, 227, 211, 0.06) 0%, rgba(67, 130, 84, 0.26) 100%);
				border-radius: 32rpx 32rpx 32rpx 32rpx;
				border: 4rpx solid rgba(108, 233, 137, 0.12);
				position: relative;

				.up-tips {
					position: absolute;
					top: 0;
					right: 0;
					padding: 10rpx 30rpx;
					background: linear-gradient(134deg, rgba(200, 246, 115, 0.06) 0%, rgba(200, 246, 115, 0.26) 100%);
					border-radius: 6rpx 32rpx 6rpx 32rpx;
					border: 4rpx solid rgba(108, 233, 137, 0.12);
					color: #A1FFA9;
					font-size: 28rpx;
				}

				.info-head {
					display: flex;
					align-items: center;
					font-weight: 600;
					font-size: 28rpx;
				
					image {
						width: 70rpx;
						height: 70rpx;
						margin-right: 20rpx;
						border-radius: 50%;
					}
				}
				.info-num {
					padding: 20rpx 0;
					display: flex;
					justify-content: space-between;
					text-align: center;
					margin-top: 8rpx;

					.num-item {
						width: 33%;

						.num {
							font-size: 24rpx;
							color: #A1FFA9;

							text {
								font-weight: 600;
								font-size: 36rpx;
							}
						}

						.num-text {
							color: #eee;
							font-size: 24rpx;
							margin-top: 10rpx;
						}
					}
				}

				.order {
					height: 71rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 32rpx;
					font-size: 24rpx;
					color: #dcdcdc;
					background-image: url('../../../static/community/text-bg.png');
					background-repeat: no-repeat;
					background-size: 100% 71rpx;
					padding: 0 20rpx;
					.order-time {
						color: #fff;
					}
				}
			}

			.up-box {
				padding: 30rpx;
				background: linear-gradient(134deg, rgba(255, 227, 211, 0.06) 0%, rgba(67, 130, 84, 0.26) 100%);
				border: 4rpx solid rgba(108, 233, 137, 0.12);
				border-radius: 30rpx;
				margin: 30rpx 0;
				display: flex;
				justify-content: center;

				.up-bg {
					width: 390rpx;
					height: 644rpx;
				}
			}
		}
	}
</style>